﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 状态模式
{
    /// <summary>
    /// 对象传递上下文
    /// </summary>
    public class Context
    {

        private AbstractState state; //状态

        public AbstractState State {
            get {
                return state;
            }
            set {
                state = value;
                Console.WriteLine("当前状态:{0}", state.GetType().Name);
            }
        }

        public void Request()
        {
            this.state.Handler(this);
        }
    }
}
